home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FNTPAK32.ZIP
/
C.EXE
/
DEMO_SYM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-16
|
4KB
|
128 lines
/***********************************************************************
Demo_SYM.C Copyright 1994, Rob W. Smetana
TURN screen-swapping on if appropriate!!!
Demonstrate how to:
1. Select symbols (or icons) from Font Pak's library.
2. Determine how many symbols there are.
Requires:
1. LdSymbols.OBJ (text-mode symbols)
Notes:
It is CRITICAL that you be in TEXT-mode when you call the
text-mode procedures. A crash awaits you if you're not.
*************************************************************************/
#include <font_pak.h> /* for prototypes */
#include <dos.h> /* for CLS (Clear Screen) and LOCATE */
/* We'll demonstrate these functions.
Prototypes are in Font_Pak.H. Functions are in LDCursor.Obj.
void extern pascal far RSLOADSYMBOL (int, int, int);
int extern pascal far NUM16SYMBOLS ();
int extern pascal far GetMonitor (); (in video.obj)
*/
#define VIDEO 0x10 /* ditto */
/* prototypes for local functions */
void locate (unsigned char , unsigned char);
void cls (unsigned char);
/* locate the cursor using BIOS SetCursor function -- page 0 hardcoded */
void locate (row, col)
unsigned char row, col;
{
union REGS reg;
reg.h.ah = 2;
reg.h.dh = row-1; /* we use 1,1 as top, left; BIOS uses 0,0 */
reg.h.dl = col-1;
reg.h.bh = 0;
int86(VIDEO, ®, ®);
}
/* CLS using BIOS Scroll function */
void cls (colr)
unsigned char colr;
{
union REGS reg;
reg.h.ah = 6; /* service 6 -- scroll up */
reg.h.al = 0; /* scroll 0 lines -- clear */
reg.h.ch = 0; /* scroll 25 x 80 screen: 0,0 to 24,79 */
reg.h.cl = 0;
reg.h.dh = 24;
reg.h.dl = 79;
reg.h.bh = colr;
int86(VIDEO, ®, ®);
}
int main (void)
{
int WhichSymbol, Block, AsciiCode;
int NumSymbols;
NumSymbols = NUM16SYMBOLS (); /* how many 16-point symbols are there?*/
cls(27);
locate (1, 1);
if (GETMONITOR() < 4) /* Bail out if no EGA/VGA */
{
printf ("Sorry. This demo requires an EGA, VGA or compatible monitor.");
return (-99);
}
printf(" Demonstrate using Font Pak's %d TEXT-MODE symbols and icons.\n\n",NumSymbols);
printf(" NOTE: We're displaying 2 symbols at once -- since some are 2-byte symbols.\n");
printf(" BE SURE to read Font Pak's manual for important tips on using symbols.\n\n");
printf(" Press <SPACE> to move to the next one.");
AsciiCode = 192; /* re-map the shape of ASCII 192 & 193 */
for (WhichSymbol = 1; WhichSymbol < NumSymbols+1; WhichSymbol++)
{
/* load the next one */
RSLOADSYMBOL (0, WhichSymbol, AsciiCode);
RSLOADSYMBOL (0, WhichSymbol+1, AsciiCode+1);
locate (12, 26);
printf ("Here are symbols %d and %d --> └┴ ", WhichSymbol, WhichSymbol + 1);
/* wait for a key */
getch ();
WhichSymbol = WhichSymbol + 1; /* displaying 2, so step by 2 */
/* gotoxy (30,4); write('This is cursor # ', WhichSymbol); */
}
cls(27);
RSLOADDEFAULT(14, 0); /* restore the default font */
RSLOADDEFAULT(16, 0);
locate (12, 15);
printf ("That's all . . . And remember, this was ALL in TEXT mode!\n\n\n\n\n");
return (0);
} /* end main */